package com.wuze.cloud.controller;

import com.wuze.cloud.model.SysRegisterData;
import com.wuze.cloud.model.SysUploadData;
import com.wuze.cloud.request.SysUpdateSpaceQuery;
import com.wuze.cloud.response.SysStorageInfoAdminVO;
import com.wuze.cloud.response.SysStorageInfoVO;
import com.wuze.cloud.result.Result;
import com.wuze.cloud.service.SysStorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: wuze
 * @description:
 * @date: 2023/02/28
 */
@RestController
public class SysStorageController {

    public static final String PREFIX_PATH = "/sys/storage/";

    @Autowired
    private SysStorageService storageService;

    @PostMapping(PREFIX_PATH+"getInfo/v1")
    public Result<SysStorageInfoVO> getInfo(){
        return Result.success(storageService.getInfo());
    }

    @PostMapping(PREFIX_PATH+"getInfoAdmin/v1")
    public Result<List<SysStorageInfoAdminVO>> getInfoAdmin(@RequestParam("top") Integer top){
        return Result.success(storageService.getInfoAdmin(top));
    }

    @PostMapping(PREFIX_PATH+"dilatation/v1")
    public Result<Boolean> dilatation(@RequestBody SysUpdateSpaceQuery query){
        storageService.dilatation(query);
        return Result.success(Boolean.TRUE);
    }

    @PostMapping(PREFIX_PATH+"reduction/v1")
    public Result<Boolean> reduction(@RequestBody SysUpdateSpaceQuery query){
        storageService.reduction(query);
        return Result.success(Boolean.TRUE);
    }


}
